import { defHttp } from "/@/utils/http/axios"
import { Modal } from "ant-design-vue"

enum Api {
  list = "/pay-service/mch/payConfig/list",
  update = "/pay-service/mch/payConfig/update",
  getPayConfig = "/pay-service/mch/payConfig/getPayConfig",
  addPayIf = "/pay-service/mch/payConfig/addPayIf",
  delete = "/pay-service/mch/payConfig/delete",
  deleteBatch = "/pay-service/mchApp/deleteBatch",
}

/**
 * 查询列表
 * @param params
 */
export const listPayConfig = (params) => {
  return defHttp.get({ url: Api.list, params })
}

/**
 * 获取相信信息
 * @param params
 */
export const getPayConfig = (params) => {
  return defHttp.get({ url: Api.getPayConfig, params })
}

/**
 * 添加支付接口
 * @param params
 * @returns
 */
export const addPayIf = (params) => {
  return defHttp.post({ url: Api.addPayIf, params })
}

/**
 * 删除
 * @param params
 */
export const deletePayConfig = (params, handleSuccess) => {
  return defHttp.delete({ url: Api.delete, data: params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess()
  })
}

/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdatePayConfig = (params, isUpdate) => {
  return defHttp.post({ url: Api.update, params })
}
